package com.dongwu.manager.entity;


import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.springframework.format.annotation.DateTimeFormat;

import com.dongwu.common.entity.BaseEntity;
import com.dongwu.security.entity.User;
import com.fasterxml.jackson.annotation.JsonFormat;

@Entity
public class DeviceProductRecord extends BaseEntity<String>{
   
	
	/**
     * 设备起始时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date startTime; //投放开始时间

	/**
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date endTime; // 投放结束时间
    
    private String productid; // 商品ID
    
    private String deviceid; // 设备ID
    
    private Integer status; //状态
    
    @ManyToOne(cascade={CascadeType.MERGE,CascadeType.REFRESH})
    @JoinColumn(name="userid")
    private User user;

    @ManyToOne(cascade = CascadeType.REFRESH)  
    @JoinColumn(name = "productid",insertable=false,updatable=false) 
    private Product product; // 商品

	
    @ManyToOne(cascade = CascadeType.REFRESH)  
    @JoinColumn(name = "deviceid",insertable=false,updatable=false) 
    private Device device; // 设备 

	private String remark; //备注

	public Device getDevice() {
		return device;
	}

	public String getDeviceid() {
		return deviceid;
	}

	public Date getEndTime() {
		return endTime;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getProductid() {
		return productid;
	}
	
	public String getRemark() {
		return remark;
	}

	public Date getStartTime() {
		return startTime;
	}

	public User getUser() {
		return user;
	}

	public void setDevice(Device device) {
		this.device = device;
	}

	public void setDeviceid(String deviceid) {
		this.deviceid = deviceid;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}



	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public void setProductid(String productid) {
		this.productid = productid;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public void setUser(User user) {
		this.user = user;
	}

	
	
    
}